#ifndef DISTANCE_HPP
#define DISTANCE_HPP

#include "Geo.hpp"

struct EuclideanDistance
{
    typedef Point2D object_T;
    typedef std::vector<object_T> objectList_T;

    real operator()( object_T const & p1, object_T const & p2 )
    {
        return ( p1 - p2 ).norm();
    }

    object_T findCentroid( objectList_T const & objList );
};

struct AnisotropicDistance
{
    typedef Point2D object_T;
    typedef std::vector<object_T> objectList_T;
    typedef Eigen::Matrix2d tensor_T;

    void setTensor( tensor_T const & tensor )
    {
        M_tensor = tensor;
    }

    real operator()( Point2D const & p1, Point2D const & p2 )
    {
        return ( p1 - p2 ).dot( M_tensor * ( p1 - p2 ) );
    }

    object_T findCentroid( objectList_T const & objList );

private:
     tensor_T M_tensor;
};

#endif // DISTANCE_HPP
